using micromsg;
using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Protocol;
using System;
namespace MicroMsg.Scene
{
	public class NetSceneSayHiEx : NetSceneBaseEx<VerifyUserRequest, VerifyUserResponse, VerifyUserRequest.Builder>
	{
		private const string TAG = "NetSceneSayHiEx";
		private EventConst onSuccessEvent;
		private EventConst onFailedEvent;
		public void doSceneEx(string userName, string content, AddContactScene scene, EventConst onSuccess, EventConst onFailed)
		{
			this.onFailedEvent = onFailed;
			this.onSuccessEvent = onSuccess;
			base.beginBuilder();
			this.mBuilder.BaseRequest = NetSceneBase.makeBaseRequest(0);
			this.mBuilder.AddVerifyUserList(VerifyUser.CreateBuilder().SetValue(userName).Build());
			this.mBuilder.VerifyUserListSize = (uint)this.mBuilder.VerifyUserListCount;
			this.mBuilder.AddSceneList((uint)scene);
			this.mBuilder.SceneListNum = (uint)this.mBuilder.SceneListCount;
			this.mBuilder.Opcode = 2u;
			this.mBuilder.VerifyContent = content;
			this.mSessionPack.mConnectMode = 2;
			this.mSessionPack.mCmdID = 44;
			base.endBuilder();
		}
		protected override void onFailed(VerifyUserRequest request, VerifyUserResponse response)
		{
			Log.smethod_1("NetSceneSayHiEx", "say hi failed ");
			EventCenter.postEvent(this.onFailedEvent, -800000, null);
		}
		protected override void onSuccess(VerifyUserRequest request, VerifyUserResponse response)
		{
			RetConst ret = (RetConst)response.BaseResponse.Ret;
			if (ret == RetConst.MM_OK)
			{
				Log.smethod_5("NetSceneSayHiEx", "say hi success. username = " + request.VerifyUserListList.get_Item(0).Value);
				EventCenter.postEvent(this.onSuccessEvent, ret, null);
				return;
			}
			Log.smethod_1("NetSceneSayHiEx", "say hi failed,   ret = " + ret);
			EventCenter.postEvent(this.onFailedEvent, ret, null);
		}
	}
}
